<?php
/**
 * @version		$Id: orders.php 5 2011-12-19 14:45:07Z netix.mail@gmail.com $
 * @package		ALM Hoster
 * @desription	Web hosting and domain menager for resellers
 * @subpackage	Components
 * @copyright	Copyright (C) 2011 ALM Studio. All rights reserved.
 * @author		ALM Studio
 * @email		info@alm-studio.net
 * @link		http://alm-studio.net
 * @license		Commercial
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.controlleradmin');


class AlmHosterControllerOrders extends JControllerAdmin
{
	public function getModel($name = 'Order', $prefix = 'AlmHosterModel') 
	{
		$model = parent::getModel($name, $prefix, array('ignore_request' => true));
		return $model;
	}
	
	function createInvoice() {
		$app = JFactory::getApplication();	
		$model       = &$this->getModel ( 'Orders' );			
			$orderData = $model->orderData();
			$createInvoice = $model->createInvoice();	
			$msg         	= JText::_( 'COM_ALMHOSTER_INVOICE_CREATED' ) ;		
			$urlredirect	= "index.php?option=com_almhoster&view=orders";
			$app->redirect( $urlredirect, $msg );		
	}
	
	function suspendAccount() {
		$app = JFactory::getApplication();	
		$model       = &$this->getModel ( 'Orders' );		
			$orderData = $model->orderData();
			$suspendAccount = $model->suspendAccount();	
			$msg         	= JText::_( 'COM_ALMHOSTER_ACCOUNT_SUSPENDED' ) ;		
			$urlredirect	= "index.php?option=com_almhoster&view=orders";
			$app->redirect( $urlredirect, $msg );
	}
	
	function unsuspendAccount() {
		$app = JFactory::getApplication();	
		$model       = &$this->getModel ( 'Orders' );		
			$orderData = $model->orderData();
			$unsuspendAccount = $model->unsuspendAccount();	
			$msg         	= JText::_( 'COM_ALMHOSTER_ACCOUNT_UNSUSPENDED' ) ;		
			$urlredirect	= "index.php?option=com_almhoster&view=orders";
			$app->redirect( $urlredirect, $msg );
	}
}
